//
//  JFBOrderProductDS.m
//  ios-supplier
//
//  Created by ccu on 15/8/25.
//  Copyright (c) 2015年 feynmanyuan. All rights reserved.
//

#import "JFBOrderProductDS.h"

@implementation JFBOrderProductDS

/*
 ///采购条目ID
 @property (nonatomic,assign) NSInteger ID;
 ///商家商品ID
 @property (nonatomic,assign) NSInteger merchantProductId;
 ///商家商品编码
 @property (nonatomic,  copy) NSString *merchantProductCode;
 ///采购产品ID
 @property (nonatomic,assign) NSInteger productId;
 ///采购产品编码
 @property (nonatomic,  copy) NSString *productCode;
 ///采购产品名称
 @property (nonatomic,  copy) NSString *productName;
 ///采购产品规格
 @property (nonatomic,  copy) NSString *productSpec;
 ///采购产品进价
 @property (nonatomic,assign) NSInteger productPrice;
 ///采购产品条形码
 @property (nonatomic,  copy) NSString *productBarcode;
 ///采购数量
 @property (nonatomic,assign) NSInteger purchaseCount;
 ///采购产品税率
 @property (nonatomic,  copy) NSString *taxRate;
 ///采购产品类目ID
 @property (nonatomic,assign) NSInteger productCategoryId;
 ///采购产品类目名称
 @property (nonatomic,  copy) NSString *productCategoryName;
 ///采购产品品牌ID
 @property (nonatomic,assign) NSInteger productBrandId;
 ///采购产品品牌名称
 @property (nonatomic,  copy) NSString *productBrandName;
 ///商品图片地址
 @property (nonatomic,  copy) NSString *photoUrl;
 ///是否精品
 @property (nonatomic,assign) NSInteger isHighQuality;
 */
- (instancetype)initWithAttributes:(NSDictionary *)attributes
{
    self = [super init];
    if (!self) {
        return nil;
    }
    self.ID = [[attributes objectForKey:@"id"]isEqual:[NSNull null]]?0:[[attributes objectForKey:@"id"] integerValue];
    self.merchantProductId = [[attributes objectForKey:@"merchantProductId"]isEqual:[NSNull null]]?0:[[attributes objectForKey:@"merchantProductId"] integerValue];
    self.merchantProductCode = [[attributes objectForKey:@"merchantProductCode"]isEqual:[NSNull null]]?0:[attributes objectForKey:@"merchantProductCode"];
    self.productId = [[attributes objectForKey:@"productId"]isEqual:[NSNull null]]?0:[[attributes objectForKey:@"productId"] integerValue];
    self.productCode    = [[attributes objectForKey: @"productCode"] isEqual: [NSNull null]] ? 0 : [attributes objectForKey: @"productCode"];
    self.productName = [[attributes objectForKey: @"productName"] isEqual: [NSNull null]] ? 0 : [attributes objectForKey: @"productName"];
    self.productSpec   = [[attributes objectForKey: @"productSpec"] isEqual: [NSNull null]] ? 0 : [attributes objectForKey: @"productSpec"] ;
    self.productPrice   = [[attributes objectForKey: @"productPrice"] isEqual: [NSNull null]] ? 0 : [attributes objectForKey: @"productPrice"];
    self.productBarcode   = [[attributes objectForKey: @"productBarcode"] isEqual: [NSNull null]] ? 0 : [attributes objectForKey: @"productBarcode"] ;
    self.purchaseCount  = [[attributes objectForKey: @"purchaseCount"] isEqual: [NSNull null]] ? 0 : [[attributes objectForKey:@"purchaseCount"] integerValue];
    self.taxRate    = [[attributes objectForKey: @"taxRate"] isEqual: [NSNull null]] ? 0 : [attributes objectForKey: @"taxRate"];
    self.productCategoryId = [[attributes objectForKey: @"productCategoryId"] isEqual: [NSNull null]] ? 0 : [[attributes objectForKey: @"productCategoryId"] integerValue];
    self.productCategoryName   = [[attributes objectForKey: @"productCategoryName"] isEqual: [NSNull null]] ? 0 : [attributes objectForKey: @"productCategoryName"] ;
    self.productBrandId   = [[attributes objectForKey: @"productBrandId"] isEqual: [NSNull null]] ? 0 : [[attributes objectForKey: @"productBrandId"] integerValue];
    self.productBrandName   = [[attributes objectForKey: @"productBrandName"] isEqual: [NSNull null]] ? 0 : [attributes objectForKey: @"productBrandName"] ;
    self.photoUrl  = [[attributes objectForKey: @"photoUrl"] isEqual: [NSNull null]] ? 0 : [attributes objectForKey:@"photoUrl"];
    self.isHighQuality = [[attributes objectForKey:@"isHighQuality"]isEqual:[NSNull null]]?0:[[attributes objectForKey:@"isHighQuality"] integerValue];
    self.inStorage = self.purchaseCount;
    return self;
}
@end
